// 传统信号处理算法脉冲压缩类定义
#ifndef __PC_H__
#define __PC_H__
#include <zmq.hpp>
#include <string>

class PC {
public:
    PC(
        const std::string& topicAddr, const std::string& topicName,
        const std::string& pushAddr
    );
    ~PC();
    void startup();

private:
    std::string topicAddr;
    std::string topicName;
    zmq::context_t ctx;
    zmq::socket_t sub;
    // 向MTI推送
    zmq::socket_t push_socket;
    std::string push_address;
};

class MTI {
public:
    MTI(const std::string& pull_address, const std::string& push_address);
    ~MTI();
    
    void startup();
    
private:
    zmq::context_t context;
    zmq::socket_t pull_socket;
    zmq::socket_t push_socket;
    std::string pull_address;
    std::string push_address;
    
    void performMTI(float* input, float* output, size_t size);
};

class MTD {
public:
    MTD(const std::string& pull_address, const std::string& push_address);
    ~MTD();
    
    void startup();
    
private:
    zmq::context_t context;
    zmq::socket_t pull_socket;
    zmq::socket_t push_socket;
    std::string pull_address;
    std::string push_address;
    
    void performMTD(float* input, float* output, size_t size);
};

/*class CFAR {
public:
    CFAR(const std::string& pull_address, const std::string& push_address);
    ~CFAR();
    
    void startup();
    
private:
    zmq::context_t context;
    zmq::socket_t pull_socket;
    zmq::socket_t push_socket;
    std::string pull_address;
    std::string push_address;
    
    void performCFAR(float* input, float* output, size_t size);
};*/
class CFAR {
public:
    CFAR(const std::string& pull_address, const std::string& rep_address);
    ~CFAR();
    
    void startup();
    void setThreshold(float threshold);
    
private:
    zmq::context_t context;
    zmq::socket_t pull_socket;
    zmq::socket_t rep_socket;
    std::string pull_address;
    std::string rep_address;
    
    float threshold = 0.01;
    
    void performCFAR(float* input, float* output, size_t size);
};

#endif